#!/bin/bash -eu

if [ `git symbolic-ref --short HEAD` != "latest" ]
then
  echo "can not publish from a non master branch" >&2
  exit 1
fi

if [ "$(git status --porcelain)" != "" ]
then
  echo "git status not clean!" >&2
  exit 1
fi

echo "Trying to publish..."

gulp all
./travis-test
script/version-bump
npm publish
